<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .div {
            width: 400px;
            margin: 100px auto;
        }

        .div .hand,
        .body div {
            display: flex;
            margin: 5px 0;
        }
    </style>
</head>

<body>
    <div class="div">
        <div class="hand">
            <input type="checkbox" name="" id="che">
            <div>胡歌</div>
            <div>轩辕剑</div>
        </div>
        <div class="body">
            <div>
                <input type="checkbox">
                <div>胡歌</div>
                <div>轩辕剑</div>
            </div>
            <div>
                <input type="checkbox">
                <div>胡歌</div>
                <div>轩辕剑</div>
            </div>
            <div>
                <input type="checkbox">
                <div>胡歌</div>
                <div>轩辕剑</div>
            </div>
            <div>
                <input type="checkbox">
                <div>胡歌</div>
                <div>轩辕剑</div>
            </div>
            <div>
                <input type="checkbox">
                <div>胡歌</div>
                <div>轩辕剑</div>
            </div>
        </div>
    </div>
    <script>
        var ins = document.querySelector('.hand input')
        var ins1 = document.querySelector('.body').querySelectorAll('input')
        //   console.log(ins1);
        ins.onclick = function () {
            console.log(this);
            for (let i = 0; i < ins1.length; i++) {
                ins1[i].checked = this.checked;
            }
        }

        for (let i = 0; i < ins1.length; i++) {
            ins1[i].onclick = function () {
                console.log(this);
                    flag=true
                    for(i=0;i<ins1.length;i++){
                        if(!ins1[i].checked){
                            flag=false
                        }
                   }  
                  ins.checked=flag
            }
        }
    </script>
</body>

</html>